/******************************************************************************
 * Copyright (C) 2024 EternalChip, Inc.(Gmbh) or its affiliates.
 * 
 * All Rights Reserved.
 * 
 * @file bsp_led.h
 * 
 * @par dependencies 
 * - stdio.h
 * - stdint.h
 * 
 * - stm32f4xx_hal.h
 * 
 * @author Zhang Yuying
 * 
 * @brief Provide the HAL APIs of Key and corresponding opetions.
 * 
 * Processing flow:
 * 
 * call directly.
 * 
 * @version V1.0 2025-08-08
 *
 * @note 1 tab == 4 spaces!
 * 
 *****************************************************************************/

 #ifndef __BSP_LED_H__
 #define __BSP_LED_H__

 //******************************** Includes *********************************//

#include <stdint.h>               // 编译器提供的通用库包含部分
#include <stdio.h>

#include "main.h"
#include "cmsis_os.h"

#include "queue.h"
#include "stm32f4xx_hal.h"

//******************************** Includes *********************************//

//******************************** Defines **********************************//
//******************************** Thread Func **********************************//
extern       osThreadId_t   led_TaskHandle;
extern const osThreadAttr_t led_Task_attributes;
//******************************** Thread Func **********************************//

/************************* Queue Handler **************************************/
extern QueueHandle_t led_queue;
/************************* Queue Handler **************************************/
/*  函数返回状态枚举                    */
typedef enum
{
  LED_OK                = 0,            /* Operation completed successfully.  */
  LED_ERROR             = 1,            /* Run-time error without case matched*/
  LED_ERRORTIMEOUT      = 2,            /* Operation failed with timeout      */
  LED_ERRORRESOURCE     = 3,            /* Resource not available.            */
  LED_ERRORPARAMETER    = 4,            /* Parameter error.                   */
  LED_ERRORNOMEMORY     = 5,            /* Out of memory.                     */
  LED_ERRORISR          = 6,            /* Not allowed in ISR context         */
  LED_RESERVED          = 0x7FFFFFFF    /* Reserved                           */
} led_status_t;

/* led状态枚举 */
typedef enum
{
  LED_OFF                = 0,            /* Operation completed successfully.  */
  LED_ON                 = 1,            /* Run-time error without case matched*/
  LED_TOGGLE             = 2,            /* Operation failed with timeout      */
} led_operation_t;

//******************************** Defines **********************************//

//******************************** Declaring ********************************//

/* led驱动函数 */
 led_status_t led_on_off       (led_operation_t led_opertion);
 void         led_task_func  (void *argument);


 //******************************** Declaring ********************************//

 #endif /* __BSP_KEY_H__ */



